<?php 
header("Content-Type: text/html;charset=utf-8");
include("function/_nosql.php"); //
include("function/function.php");
include("_include.user.judge.php");
$kboy_userid = $_SESSION['kboy_userid'];
$kboy_user = $_SESSION['kboy_user'];
$action = chkstr(trim($_REQUEST['action']));
$id = chkstr(trim($_REQUEST['id']));

if($action=='shanchu'){//删除
$mysql = new sqlstr("kboy_forum_travel_message"); 
$news_sql = $mysql -> deleteSql("id=$id");
$news_res = mysql_query($news_sql);
if($news_res){
$arr['status'] = 0;
}
else{
$arr['status'] = (-1);
}
echo json_encode($arr);
}elseif($action == 'dianzan'){
//	echo "aaa"."_".$kboy_userid."_".getClassName("kboy_forum_travel_message","uid","id=$id")."__".$id;
//	exit();

		if(getNewsNums("kboy_travel_good","newsid=$id and uid=$kboy_userid") >0){//已经点过赞了
		$arr['status'] = (1);
		}
		else{
			$mysql = new sqlstr("kboy_forum_travel_message"); 
			$news_good = getClassName("kboy_forum_travel_message","news_good","id=$id");
			$news_good = $news_good+1;
			$mysql -> set("news_good",$news_good);
			$news_sql = $mysql -> updateSql("id=$id");
			$news_res = mysql_query($news_sql);
			mysql_query(" insert into `kboy_travel_good`(`newsid`,`uid`) values( '".$id."' , '".$kboy_userid."' ) ");
			if($news_res){
			$arr['status'] = 0;
			}
			else{
			$arr['status'] = (-1);
			}
		}	
	echo json_encode($arr);
}else{
 echo erro('服务器内部错误');
}
/*if ($action=='delchildmsg' || $action=='shoucang' || $action=='shanchu') {
	echo '{"status":0}';
}else{
	// param: 0 成功  1 已经赞过 其他 失败
	echo '{"status":0,"home":"http://baidu.com","name":"陈红","head":"http://localhost/images/f_pic1_6.jpg"}';	
}*/
	
 ?>